<?php
/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ProductGroupLinkGen
 * We assume that ProductGroup tree is not TOO big (MAX 1000 elements)
 * In production groupMap should be cached
 *
 * @author aneto
 */
class SectionProductGroupLinkGen extends ProductGroupLinkGen{

	static $groupMap;

	protected function init(){
		$q = Doctrine_Query::create()
			->from('ProductGroup pg')
			->leftJoin('pg.Translation pgt')
			->innerJoin('pg.StructureProductGroup spg')
			->innerJoin('spg.Structure s WITH s.lang = ? AND s.parameter = ?', array(Doctrine::getTable('Language')->findOneByAbr($this->getCulture())->getUrl(), 'section'))
			->setHydrationMode(Doctrine::HYDRATE_ARRAY_HIERARCHY);


		$this->setData($q->execute());
	}
}
